home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / xml2po / xhtml.py < prev    next >
Encoding:
Python Source  |  2007-04-09  |  2.3 KB  |  65 lines

  1. # Copyright (c) 2004, 2005, 2006 Danilo Segan <danilo@gnome.org>.
  2. # Copyright (c) 2006 Claude Paroz <paroz@email.ch>.
  3. #
  4. # This file is part of xml2po.
  5. #
  6. # xml2po is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # xml2po is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with xml2po; if not, write to the Free Software Foundation, Inc.,
  18. # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. #
  20.  
  21. # This implements special instructions for handling XHTML documents
  22. # in a better way, particularly to extract some attributes in HTML tags
  23.  
  24. class xhtmlXmlMode:
  25.     """Class for special handling of XHTML document types."""
  26.     def getIgnoredTags(self):
  27.         "Returns array of tags to be ignored."
  28.         return []
  29.  
  30.     def getFinalTags(self):
  31.         "Returns array of tags to be considered 'final'."
  32.         return ['p', 'li', 'pre']
  33.  
  34.     def getTreatedAttributes(self):
  35.         "Returns array of tag attributes which content is to be translated"
  36.         return ['title','alt']
  37.  
  38.     def getSpacePreserveTags(self):
  39.         "Returns array of tags in which spaces are to be preserved."
  40.         return ['pre']
  41.  
  42.     def preProcessXml(self, doc, msg):
  43.         "Preprocess a document and perhaps adds some messages."
  44.         pass
  45.  
  46.     def postProcessXmlTranslation(self, doc, language, translators):
  47.         """Sets a language and translators in "doc" tree.
  48.  
  49.         "translators" is a string consisted of translator credits.
  50.         "language" is a simple string.
  51.         "doc" is a libxml2.xmlDoc instance."""
  52.         pass
  53.  
  54.     def getStringForTranslators(self):
  55.         """Returns None or a string to be added to PO files.
  56.  
  57.         Common example is 'translator-credits'."""
  58.         return None
  59.  
  60.     def getCommentForTranslators(self):
  61.         """Returns a comment to be added next to string for crediting translators.
  62.  
  63.         It should explain the format of the string provided by getStringForTranslators()."""
  64.         return None
  65.